# Copyright 2023 Ant Group Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("//bazel:psi.bzl", "psi_cc_binary", "psi_cc_library", "psi_cc_test")

package(default_visibility = ["//visibility:public"])

psi_cc_library(
    name = "factory",
    srcs = ["factory.cc"],
    hdrs = ["factory.h"],
    deps = [
        "//experiment/psi/threshold_ub_psi:client",
        "//experiment/psi/threshold_ub_psi:server",
        "//psi/algorithm/ecdh:receiver",
        "//psi/algorithm/ecdh:sender",
        "//psi/algorithm/ecdh/ub_psi:client",
        "//psi/algorithm/ecdh/ub_psi:server",
        "//psi/algorithm/kkrt:receiver",
        "//psi/algorithm/kkrt:sender",
        "//psi/algorithm/rr22:receiver",
        "//psi/algorithm/rr22:sender",
        "@yacl//yacl/base:exception",
    ],
)

psi_cc_library(
    name = "report",
    hdrs = ["report.h"],
)

psi_cc_library(
    name = "launch",
    srcs = ["launch.cc"],
    hdrs = ["launch.h"],
    deps = [
        ":factory",
        ":report",
        "//psi:trace_categories",
        "//psi/algorithm/dkpir:entry",
        "//psi/config:psi_config",
        "//psi/config:ub_psi_config",
        "//psi/legacy:bucket_psi",
        "//psi/proto:pir_cc_proto",
        "//psi/wrapper/apsi/cli:entry",
        "@boost.algorithm//:boost.algorithm",
    ],
)

psi_cc_test(
    name = "psi_test",
    srcs = ["psi_test.cc"],
    flaky = True,
    deps = [
        ":factory",
        ":launch",
        "//psi/utils:arrow_csv_batch_provider",
        "@yacl//yacl/utils:scope_guard",
    ],
)

psi_cc_library(
    name = "kuscia_adapter",
    srcs = [
        "kuscia_adapter.cc",
    ],
    hdrs = [
        "kuscia_adapter.h",
    ],
    deps = [
        "//psi/proto:entry_cc_proto",
        "//psi/proto:kuscia_cc_proto",
        "@protobuf",
        "@rapidjson",
        "@yacl//yacl/base:exception",
    ],
)

psi_cc_test(
    name = "kuscia_adapter_test",
    srcs = ["kuscia_adapter_test.cc"],
    deps = [
        ":kuscia_adapter",
    ],
)

psi_cc_binary(
    name = "main",
    srcs = ["main.cc"],
    deps = [
        ":kuscia_adapter",
        ":launch",
        "//psi:version",
        "//psi/proto:entry_cc_proto",
        "//psi/utils:resource_manager",
        "@gflags",
    ],
)
